package com.huxi.lang.exception;

import static com.huxi.lang.exception.CauseManager.columnNoneIndex;
import static com.huxi.lang.exception.CauseManager.rowFirstIndex;

import java.util.List;

/**
 * 行异常
 * 
 * @since 1.0
 * @version 1.0
 * @author jian.wu
 *
 */
public class RowException extends RuntimeException implements MultipleCause {

	private static final long serialVersionUID = 1L;

	private List<Throwable> multipleCauses;
	private int columnIndex = columnNoneIndex;
	private int rowIndex;
	private Object rowValue;

	protected RowException(String message, List<Throwable> causes, int rowIndex, Object rowValue) {
		super(message, causes == null || causes.size() == 0 ? null : causes.get(1));
		this.rowIndex = rowIndex < rowFirstIndex ? columnNoneIndex : rowIndex;
		this.rowValue = rowValue;
	}

	@Override
	public List<? extends Throwable> getMultipleCauses() {
		return multipleCauses;
	}

	public int getColumnIndex() {
		return columnIndex;
	}

	public int getRowIndex() {
		return rowIndex;
	}

	public Object getRowValue() {
		return rowValue;
	}

}
